package core

import (
	"errors"
	"fmt"
	git "gopkg.in/src-d/go-git.v4"
	"os"
)

func InitGitRepo() error {
	_, err := git.PlainInit(".", false)
	if err != nil && !errors.Is(err, git.ErrRepositoryAlreadyExists) {
		return err
	}
	_ = os.WriteFile(".gitignore", []byte(`
/target/
/.idea/
*.iml
*.class
*.jar
.DS_Store
`), 0644)
	fmt.Println("✅ Initialized Git repository")
	return nil
}
